package com.example.demo.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.demo.common.Result;
import com.example.demo.entity.User;
import com.example.demo.mapper.UserMapper;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/list")
public class ListController {

    @Resource
    UserMapper userMapper;

    @GetMapping
    public Result<?> list() {
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.eq("exist", 1);
        wrapper.orderByAsc("id");
        List<User> lists = userMapper.selectList(wrapper);
        return Result.success(lists);
    }
}
